﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Forum
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
    <%= Html.Telerik().StyleSheetRegistrar()
        .DefaultGroup(group => group.Add("telerik.common.css")
                                    .Add("telerik.sitefinity.css"))
    %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="ui-corner-all ui-helper-clearfix alternate-header" id="tabs">
        <div class="ui-widget-header-title">
            Forum
        </div>
    </div>
    <div class="content-wrapper center ui-widget-content ui-corner-all">
        <%if (Request.IsAuthenticated)
          { %>
        <div>
            <div style="margin-bottom: 10px">
                <a rel="nofollow" id="new-post" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
                    title="Utwórz nowy wątek" href="<%=Url.Action("Create") %>"><span class="ui-button-text">
                        Utwórz nowy wątek</span> </a>
            </div>
            <div class="clear">
            </div>
        </div>
        <%}
          else
          { %>
        <h4>
            Aby pisać na forum musisz się zalogować.</h4>
        <%} %>
        <div>
            <% Html.Telerik().Grid<B10.Models.ForumPost>()
        .Name("posts")
        .Localizable("pl-PL")
        .DataBinding(binding => binding.Ajax().Select("_PostList", "Forum"))
        .Columns(columns =>
        {
            columns.Bound(c => c.Title).ClientTemplate(
            "<a href='"
            + Url.Action("Post", "Forum", new { id = "<#=Id#>" })
            + "' title='" + Html.Encode("<#=Title#>") + "'>"
            + Html.Encode("<#=Title#>") + "</a>"
                ).Sortable(false);
            columns.Bound(c => c.ProfileId).ClientTemplate(
            "<a href='"
            + Url.Action("Index", "PublicProfile",
                new
                {
                    name = Html.Encode("<#=UserProfile.DisplayName#>"),
                    id = Html.Encode("<#=ProfileId#>")
                })
            + "' title='" + Html.Encode("<#=UserProfile.DisplayName#>") + "'>"
             + Html.Encode("<#=UserProfile.DisplayName#>") + "</a>"
             ).Title("Autor").Width(140).Sortable(false).Filterable(false);
            columns.Bound(c => c.Date).Format("{0:dd/MM/yyyy HH:mm}").Width(140).Filterable(false);
        })
        .Pageable(p => p.PageSize(30))
        .Sortable(s => s.SortMode(GridSortMode.SingleColumn)
            .OrderBy(b => b.Add(p => p.Date).Descending()))
                   .Filterable()
        .Render();
            %>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="LeftColumnContent" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="RightColumnContent" runat="server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="RightColumnBottomContent" runat="server">
    <%= Html.Telerik().ScriptRegistrar().jQuery(false) %>
</asp:Content>
